<?php
class mysql {
	private $connection;
	private $selectDB;
	private $con = false;
	function mysql() {
		$connection = mysql_connect("localhost","geniscom_php1","genisoft") or die("Unable to connect database server.".mysql_error());
		if($connection) { 
			$selectDB = mysql_select_db("geniscom_swapen",$connection) or die("Unable to select database server.".mysql_error());
			if(selectDB) {	
				$this->con = true;
				return true; 
			} else {
				$this->con = false;
				return false;
			}
		} else {
			$this->con = false;
			return false;
		}	
	}
	
	public function selectAll($sql) {		
		if($this->con) {
			$rst = mysql_query($sql);
			$num = mysql_num_rows($rst);			
			if($num > 0) {				
				while($row = mysql_fetch_array($rst)) {
					$data[] = $row;
				}
				return $data;
			} 
			else {
				return false;
			}
						
		}
		else { return false; }
	}
	
	public function selectRow($sql) {
		$data = $this->selectAll($sql);
		if($data) {
			return $data[0];
		} else {
			return false;
		}
	}
		
}
?>